<template>
  <div class="page luckdraw-add-result">
    <list-item v-if="activityData.activity_id" :listData="activityData" :isLink="false"
      :isSwipper="true" :canPreview="true"></list-item>
    <div class="btn-section">
      <div class="btn-inner">
        <m-button text="发起抽奖邀请" type="red" openType="share"></m-button>
      </div>
    </div>
  </div>
</template>

<script>
import ListItem from 'comp/list-item'
import MButton from 'comp/m-button'
import mixins from 'comp/mixins'

export default {
  mixins: [mixins],
  components: {
    ListItem,
    MButton
  },
  data () {
    return {
      activityId: '',
      activityData: {},
      openId: ''
    }
  },
  async mounted () {
    this.resetData()
    this.openId = await this.getOpenId()
    const activityId = this.$root.$mp.query.activityId
    this.activityId = activityId
    const ret = await this.$store.dispatch('getActivityDetail', {
      activityid: this.activityId
    })
    this.activityData = ret.activity
  },
  onShareAppMessage () {
    return {
      title: `邀请你参与[${this.activityData.award_title}]抽奖`,
      path: `/pages/detail/main?activityId=${this.activityId}&from=share&shareId=${this.openId}`
    }
  },
}
</script>

<style lang="less" scoped>
.luckdraw-add-result {
  .btn-section {
    padding: 20rpx 20rpx;
    .btn-inner {
      padding: 20rpx 20rpx;
    }
  }
}
</style>
